unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, AdvObj, BaseGrid, AdvGrid, ExtCtrls, RzPanel;

type
  TDemo=class(TObject)
  public
    DemoIdex:Integer;
    DemoName:string;
  end;

  TForm1 = class(TForm)
    Grid_1: TAdvStringGrid;
    Tool_1: TRzToolbar;
    procedure Grid_1GetEditorType(Sender: TObject; ACol, ARow: Integer;
      var AEditor: TEditorType);
    procedure FormShow(Sender: TObject);
    procedure Grid_1ComboCloseUp(Sender: TObject; ARow, ACol: Integer);
    procedure Grid_1ComboChange(Sender: TObject; ACol, ARow,
      AItemIndex: Integer; ASelection: String);
  private
    FListDemo:TStringList;
  public
    procedure PropareData;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Grid_1GetEditorType(Sender: TObject; ACol, ARow: Integer;
  var AEditor: TEditorType);
var
  I:Integer;
  DemoA:TDemo;
begin
  with Grid_1 do
  begin
    if ACol=1 then
    begin
      AEditor:=edComboList;
      ClearComboString;
      for I:=0 to FListDemo.Count-1 do
      begin
        DemoA:=TDemo(FListDemo.Objects[I]);
        if DemoA=nil then Continue;

        AddComboStringObject(Format('%D:%S',[DemoA.DemoIdex,DemoA.DemoName]),DemoA);
      end;  
    end;  
  end;  
end;

procedure TForm1.PropareData;
var
  I:Integer;
  DemoA:TDemo;
begin
  if FListDemo=nil then
  begin
    FListDemo:=TStringList.Create;
  end;
  
  for I:=0 to 11 do
  begin
    DemoA:=TDemo.Create;
    DemoA.DemoIdex:=I;
    DemoA.DemoName:='Word';

    FListDemo.AddObject('',DemoA);
  end;

  Grid_1.ColWidths[1]:=200;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  PropareData;
end;

procedure TForm1.Grid_1ComboCloseUp(Sender: TObject; ARow, ACol: Integer);
var
  DemoA:TDemo;
begin
  with Grid_1 do
  begin
    if Combobox.ItemIndex=-1 then Exit;

    DemoA:=TDemo(Combobox.Items.Objects[Combobox.ItemIndex]);
    ShowMessage(DemoA.DemoName);
    Cells[RealCol,RealRow]:=DemoA.DemoName+'Ex';
  end;  
end;

procedure TForm1.Grid_1ComboChange(Sender: TObject; ACol, ARow,
  AItemIndex: Integer; ASelection: String);
begin
  //
  ASelection:='true';
end;

end.
